package io.renren.modules.cards.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.cards.entity.AmgCdkTasksEntity;
import io.renren.modules.cards.service.AmgCdkTasksService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2018-09-03 15:06:23
 */
@RestController
@RequestMapping("cards/amgcdktasks")
public class AmgCdkTasksController {
    @Autowired
    private AmgCdkTasksService amgCdkTasksService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("cards:amgcdktasks:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = amgCdkTasksService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("cards:amgcdktasks:info")
    public R info(@PathVariable("id") String id){
			AmgCdkTasksEntity amgCdkTasks = amgCdkTasksService.selectById(id);

        return R.ok().put("amgCdkTasks", amgCdkTasks);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("cards:amgcdktasks:save")
    public R save(@RequestBody AmgCdkTasksEntity amgCdkTasks){
			amgCdkTasksService.insert(amgCdkTasks);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("cards:amgcdktasks:update")
    public R update(@RequestBody AmgCdkTasksEntity amgCdkTasks){
			amgCdkTasksService.updateById(amgCdkTasks);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("cards:amgcdktasks:delete")
    public R delete(@RequestBody String[] ids){
			amgCdkTasksService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

}
